From: Jo-Philipp Wich Date: Tue, 16 Jul 2019 17:12:29 +0000 (+0200) Subject: phase1: automatically setup shared work directory symlink X-Git-Tag: v1~82 X-Git-Url: http://git.openwrt.org/%22https:/collectd.org/%22http:/www.crowdsec.net//%22https%22/%22https:/collectd.org/%22http:/www.crowdsec.net/%22https%22?a=commitdiff_plain;h=bb7b82b115ad53c48f26ac5641d4910ad501a202;p=buildbot.git phase1: automatically setup shared work directory symlink Until now, the shared work directory symlinks had to be provisioned manually, this commits automates the setup when work directory sharing is enabled for the slave. Signed-off-by: Jo-Philipp Wich --- diff --git a/phase1/master.cfg b/phase1/master.cfg index a8abbc6..ff2f3e2 100644 --- a/phase1/master.cfg +++ b/phase1/master.cfg @@ -251,9 +251,11 @@ def IsMakeCleanRequested(pattern): return CheckCleanProperty +def IsSharedWorkdir(step): + return bool(step.getProperty("shared_wd")) + def IsCleanupRequested(step): - shared_wd = step.getProperty("shared_wd") - if shared_wd: + if IsSharedWorkdir(step): return False do_cleanup = step.getProperty("do_cleanup") if do_cleanup: @@ -262,8 +264,7 @@ def IsCleanupRequested(step): return False def IsExpireRequested(step): - shared_wd = step.getProperty("shared_wd") - if shared_wd: + if IsSharedWorkdir(step): return False else: return not IsCleanupRequested(step) @@ -464,6 +465,15 @@ for target in targets: factory = BuildFactory() + # setup shared work directory if required + factory.addStep(ShellCommand( + name = "sharedwd", + description = "Setting up shared work directory", + command = 'test -L "$PWD" || (mkdir -p "../shared-workdir" && rm -rf "$PWD" && ln -s shared-workdir "$PWD")', + workdir = ".", + haltOnFailure = True, + doStepIf = IsSharedWorkdir)) + # find number of cores factory.addStep(SetPropertyFromCommand( name = "nproc",